
// chat message 原封不动返回
function ChatMessage(data, from) {
    const message = {
        from: from || '匿名',
        type: 'chat-message',
        data
    }
    return JSON.stringify(message)
}

// attention message 是系统发送的提示消息
function AttentionMsg(action, data) {
    const message = {
        from: 'system',
        type: 'attention-message',
        data: {
            action,
            text: ''
        }
    }
    Object.assign(message.data, data)
    return JSON.stringify(message)
}



module.exports.ChatMessage = ChatMessage
module.exports.AttentionMsg = AttentionMsg
